﻿

#include "pch.h"
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;

int main()
{
	Mat image = imread("E:\\VC_project\\figure\\lena.jpg");

	Mat image1, rgb, hsv, rgbChannels[3], hsvChannels[3];
	pyrDown(image, image1);
	
    //对图像进行分解，得到RGB各分量
	cvtColor(image1, rgb, COLOR_BGR2RGB);
	split(rgb, rgbChannels);
	imshow("lena", image1);
	imshow("lena_Red", rgbChannels[0]);
	imshow("lena_Green", rgbChannels[1]);
	imshow("lena_Blue", rgbChannels[2]);

	//对图像进行分解，得到HSV各分量
	cvtColor(image1, hsv, COLOR_BGR2HSV);
	split(hsv, hsvChannels);
	imshow("Hue", hsvChannels[0]);
	imshow("Saturation", hsvChannels[1]);
	imshow("Value", hsvChannels[2]);
	waitKey();
}

